﻿using System;
using System.Collections.Generic;
using Shuba.Model;

namespace Shuba.Business
{
    public class User
    {
        private Data.User _user;
        public User()
        {
            _user = new Data.User();
        }

        public List<UserInfo> GetList(string name, string AppCode)
        {
            return _user.GetList(name, AppCode);
        }

        public List<UserInfo> GetListPaging(string value, string AppCode, int currPage, int dataPerPage)
        {
            return _user.GetListPaging(value, AppCode, currPage, dataPerPage);
        }

        public int GetRowListPaging(string value, string AppCode)
        {
            return _user.GetRowListPaging(value, AppCode);
        }

        //-- Dibuat tapi belum digunakan, keperluan untuk bypass APP_ID pada V_USER
        //-- bypass agar tidak dibatasi hanya pada SPADA dan SPAWEB
        public UserInfo GetAllUser(string loginName)
        {
            return _user.GetAllUser(loginName);
        }
        //-------------------------------------------------------------------------

        public UserInfo Get(string loginName, string AppCode)
        {
            return _user.Get(loginName, AppCode);
        }

        public int GetHubSpokeUser(string loginName)
        {
            return _user.GetHubSpokeUser(loginName);
        }

        public UserInfo GetLoginInfo(string nip, string AppCode)
        {
            return _user.GetLoginInfo(nip, AppCode);
        }

        public string GetUserAlternate(string nip, string AppCode)
        {
            return _user.GetUserAlternate(nip, AppCode);
        }

        public List<UserInfo> GetUserCO(string UNIT_CODE)
        {
            return _user.GetUserCO(UNIT_CODE);
        }

        public List<UserInfo> GetUserSO(string UNIT_CODE)
        {
            return _user.GetUserSO(UNIT_CODE);
        }

        public UserInfo GetByID(Int32 UserID, string AppCode)
        {
            return _user.GetByID(UserID, AppCode);
        }

        public void Update(UserInfo user)
        {
            _user.UserUpdate(user);
        }

        public List<UserInfo> GetUserGroupName(string NIP)
        {
            return _user.GetUserGroupName(NIP);
        }

        public bool CekExistingAlternate(string UNIT_CODE, string USER_TYPE, string NIP)
        {
            return _user.CekExistingAlternate(UNIT_CODE, USER_TYPE, NIP);
        }
    }
}